#!/usr/bin/bash
set -x
# 
add-apt-repository -y cloud-archive:yoga

apt install -y python3-openstackclient

#######安装数据库###########

apt install -y mariadb-server python3-pymysql
cat <<EOF > /etc/mysql/mariadb.conf.d/99-openstack.cnf
[mysqld]
  bind-address = 10.0.2.2
  default-storage-engine = innodb
  innodb_file_per_table = on
  max_connections = 4096
  collation-server = utf8_general_ci
  character-set-server = utf8
EOF
service mysql restart

###########安装消息队列########
apt install -y rabbitmq-server
rabbitmqctl add_user openstack educoder
rabbitmqctl set_permissions openstack ".*" ".*" ".*"

##########安装memcache###########
apt install memcached python3-memcache -y
sed -i 's/127.0.0.1/10.0.2.2/g' /etc/memcached.conf
service memcached restart

#########安装ketstone############
mysql -e "CREATE DATABASE keystone"
mysql -e "GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY 'educoder'"
mysql -e "GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED BY 'educoder'"
apt install -y keystone
apt install -y crudini
crudini --set /etc/keystone/keystone.conf database connection "mysql+pymysql://keystone:educoder@ubuntu/keystone"
crudini --set /etc/keystone/keystone.conf token provider fernet
su -s /bin/sh -c "keystone-manage db_sync" keystone
keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone
keystone-manage credential_setup --keystone-user keystone --keystone-group keystone
keystone-manage bootstrap --bootstrap-password educoder \
  --bootstrap-admin-url http://ubuntu:5000/v3/ \
  --bootstrap-internal-url http://ubuntu:5000/v3/ \
  --bootstrap-public-url http://ubuntu:5000/v3/ \
  --bootstrap-region-id RegionOne

sed -i '1i\\ServerName  ubuntu' /etc/apache2/apache2.conf 
service apache2 restart
cat <<EOF > /root/adminrc
export OS_USERNAME=admin
export OS_PASSWORD=educoder
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_AUTH_URL=http://ubuntu:5000/v3
export OS_IDENTITY_API_VERSION=3
EOF

export OS_USERNAME=admin
export OS_PASSWORD=educoder
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_AUTH_URL=http://ubuntu:5000/v3
export OS_IDENTITY_API_VERSION=3

openstack project create --domain default --description "Service Project" service
openstack token issue


##########安装Glance##########
mysql -e "CREATE DATABASE glance"
mysql -e "GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'educoder'"
mysql -e "GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'educoder'"
apt install glance -y

openstack user create --domain default --password educoder glance
openstack role add --project service --user glance admin
openstack service create --name glance --description "OpenStack Image" image
openstack endpoint create --region RegionOne image public http://ubuntu:9292
openstack endpoint create --region RegionOne image internal http://ubuntu:9292
openstack endpoint create --region RegionOne image admin http://ubuntu:9292

crudini --set /etc/glance/glance-api.conf database connection  mysql+pymysql://glance:educoder@ubuntu/glance
crudini --set /etc/glance/glance-api.conf keystone_authtoken www_authenticate_uri  http://ubuntu:5000
crudini --set /etc/glance/glance-api.conf keystone_authtoken auth_url  http://ubuntu:5000
crudini --set /etc/glance/glance-api.conf keystone_authtoken memcached_servers  ubuntu:11211
crudini --set /etc/glance/glance-api.conf keystone_authtoken auth_type  password
crudini --set /etc/glance/glance-api.conf keystone_authtoken project_domain_name  Default
crudini --set /etc/glance/glance-api.conf keystone_authtoken user_domain_name  Default
crudini --set /etc/glance/glance-api.conf keystone_authtoken project_name  service
crudini --set /etc/glance/glance-api.conf keystone_authtoken username  glance
crudini --set /etc/glance/glance-api.conf keystone_authtoken password  educoder
crudini --set /etc/glance/glance-api.conf paste_deploy flavor  keystone
crudini --set /etc/glance/glance-api.conf glance_store stores file,http
crudini --set /etc/glance/glance-api.conf glance_store default_store  file
crudini --set /etc/glance/glance-api.conf glance_store filesystem_store_datadir  /var/lib/glance/images/
crudini --set /etc/glance/glance-api.conf DEFAULT use_keystone_quotas  True

su -s /bin/sh -c "glance-manage db_sync" glance
service glance-api restart

wget https://ghfast.top/https://github.com/cirros-dev/cirros/releases/download/0.5.3/cirros-0.5.3-x86_64-disk.img

glance image-create --name "cirros" \
  --file cirros-0.5.3-x86_64-disk.img \
  --disk-format qcow2 --container-format bare \
  --visibility=public


##########安装Placement########
mysql -e "CREATE DATABASE placement"
mysql -e "GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'localhost' IDENTIFIED BY 'educoder'"
mysql -e "GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' IDENTIFIED BY 'educoder'"

openstack user create --domain default --password educoder placement
openstack role add --project service --user placement admin
openstack service create --name placemen --description "Placement API" placement
openstack endpoint create --region RegionOne placement public http://ubuntu:8778
openstack endpoint create --region RegionOne placement internal http://ubuntu:8778
openstack endpoint create --region RegionOne placement admin http://ubuntu:8778

apt install -y placement-api

crudini --set /etc/placement/placement.conf placement_database connection "mysql+pymysql://placement:educoder@ubuntu/placement"
crudini --set /etc/placement/placement.conf api auth_strategy "keystone"

crudini --set /etc/placement/placement.conf keystone_authtoken auth_url "http://ubuntu:5000/v3"
crudini --set /etc/placement/placement.conf keystone_authtoken memcached_servers "ubuntu:11211"
crudini --set /etc/placement/placement.conf keystone_authtoken auth_type "password"
crudini --set /etc/placement/placement.conf keystone_authtoken project_domain_name "Default"
crudini --set /etc/placement/placement.conf keystone_authtoken user_domain_name "Default"
crudini --set /etc/placement/placement.conf keystone_authtoken project_name "service"
crudini --set /etc/placement/placement.conf keystone_authtoken username "placement"
crudini --set /etc/placement/placement.conf keystone_authtoken password educoder

su -s /bin/sh -c "placement-manage db sync" placement

service apache2 restart


###########安装Nova##########
mysql -e "CREATE DATABASE nova_api"
mysql -e "CREATE DATABASE nova"
mysql -e "CREATE DATABASE nova_cell0"
mysql -e "GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'educoder'"
mysql -e "GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'educoder'"
mysql -e "GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'educoder'"
mysql -e "GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'educoder'"
mysql -e "GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY 'educoder'"
mysql -e "GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'educoder'"

openstack user create --domain default --password educoder nova
openstack role add --project service --user nova admin
openstack service create --name nova --description "OpenStack Compute" compute
openstack endpoint create --region RegionOne compute public http://ubuntu:8774/v2.1
openstack endpoint create --region RegionOne compute internal http://ubuntu:8774/v2.1
openstack endpoint create --region RegionOne compute admin http://ubuntu:8774/v2.1

apt install -y nova-api nova-conductor nova-novncproxy nova-scheduler

crudini --set /etc/nova/nova.conf api_database connection "mysql+pymysql://nova:educoder@ubuntu/nova_api"
crudini --set /etc/nova/nova.conf database connection "mysql+pymysql://nova:educoder@ubuntu/nova"
crudini --set /etc/nova/nova.conf DEFAULT transport_url "rabbit://openstack:educoder@ubuntu:5672/"
crudini --set /etc/nova/nova.conf api auth_strategy "keystone"
crudini --set /etc/nova/nova.conf keystone_authtoken www_authenticate_uri "http://ubuntu:5000/"
crudini --set /etc/nova/nova.conf keystone_authtoken auth_url "http://ubuntu:5000/"
crudini --set /etc/nova/nova.conf keystone_authtoken memcached_servers "ubuntu:11211"
crudini --set /etc/nova/nova.conf keystone_authtoken auth_type password
crudini --set /etc/nova/nova.conf keystone_authtoken project_domain_name Default
crudini --set /etc/nova/nova.conf keystone_authtoken user_domain_name Default
crudini --set /etc/nova/nova.conf keystone_authtoken project_name service
crudini --set /etc/nova/nova.conf keystone_authtoken username nova
crudini --set /etc/nova/nova.conf keystone_authtoken password educoder
crudini --set /etc/nova/nova.conf DEFAULT my_ip 10.0.2.2
crudini --set /etc/nova/nova.conf vnc enabled true
crudini --set /etc/nova/nova.conf vnc server_listen  10.0.2.2
crudini --set /etc/nova/nova.conf vnc server_proxyclient_address  10.0.2.2
crudini --set /etc/nova/nova.conf glance api_servers "http://ubuntu:9292"
crudini --set /etc/nova/nova.conf oslo_concurrency lock_path "/var/lib/nova/tmp"
crudini --set /etc/nova/nova.conf placement region_name RegionOne
crudini --set /etc/nova/nova.conf placement project_domain_name Default
crudini --set /etc/nova/nova.conf placement project_name service
crudini --set /etc/nova/nova.conf placement auth_type password
crudini --set /etc/nova/nova.conf placement user_domain_name Default
crudini --set /etc/nova/nova.conf placement auth_url "http://ubuntu:5000/v3"
crudini --set /etc/nova/nova.conf placement username placement
crudini --set /etc/nova/nova.conf placement password educoder

su -s /bin/sh -c "nova-manage api_db sync" nova
su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
su -s /bin/sh -c "nova-manage db sync" nova
su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova

service nova-api restart
service nova-scheduler restart
service nova-conductor restart
service nova-novncproxy restart


apt install -y nova-compute

crudini --set /etc/nova/nova.conf service_user  send_service_user_token  true
crudini --set /etc/nova/nova.conf service_user  auth_url  http://ubuntu:5000/v3
crudini --set /etc/nova/nova.conf service_user  auth_strategy  keystone
crudini --set /etc/nova/nova.conf service_user  auth_type  password
crudini --set /etc/nova/nova.conf service_user  project_domain_name  Default
crudini --set /etc/nova/nova.conf service_user  project_name  service
crudini --set /etc/nova/nova.conf service_user  user_domain_name  Default
crudini --set /etc/nova/nova.conf service_user  username  nova
crudini --set /etc/nova/nova.conf service_user  password  educoder

crudini --set /etc/nova/nova.conf vnc enabled true
crudini --set /etc/nova/nova.conf vnc server_listen  0.0.0.0
crudini --set /etc/nova/nova.conf vnc server_proxyclient_address  10.0.2.2
crudini --set /etc/nova/nova.conf vnc novncproxy_base_url  http://ubuntu:6080/vnc_auto.html

service nova-compute restart

sleep 10
su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova

openstack compute service list --service nova-compute


#############安装Neutron###########
mysql -e "CREATE DATABASE neutron"
mysql -e "GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY 'educoder'"
mysql -e "GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY 'educoder'"

openstack user create --domain default --password educoder neutron
openstack role add --project service --user neutron admin
openstack service create --name neutron  --description "OpenStack Networking" network
openstack endpoint create --region RegionOne network public http://ubuntu:9696
openstack endpoint create --region RegionOne network internal http://ubuntu:9696
openstack endpoint create --region RegionOne network admin http://ubuntu:9696


cat <<EOF >/etc/radvd.conf
interface enp1s0              
{
        AdvSendAdvert on;
        MinRtrAdvInterval 30;
        MaxRtrAdvInterval 600;
};
EOF

apt install -y neutron-server neutron-plugin-ml2 \
  neutron-linuxbridge-agent neutron-l3-agent neutron-dhcp-agent \
  neutron-metadata-agent

crudini --set  /etc/neutron/neutron.conf database connection  mysql+pymysql://neutron:educoder@ubuntu/neutron
crudini --set  /etc/neutron/neutron.conf DEFAULT core_plugin  ml2
crudini --set  /etc/neutron/neutron.conf DEFAULT service_plugins router
crudini --set  /etc/neutron/neutron.conf DEFAULT allow_overlapping_ips  true
crudini --set  /etc/neutron/neutron.conf DEFAULT transport_url  rabbit://openstack:educoder@ubuntu
crudini --set  /etc/neutron/neutron.conf DEFAULT auth_strategy  keystone
crudini --set  /etc/neutron/neutron.conf DEFAULT notify_nova_on_port_status_changes  true
crudini --set  /etc/neutron/neutron.conf DEFAULT notify_nova_on_port_data_changes  true

crudini --set  /etc/neutron/neutron.conf  keystone_authtoken www_authenticate_uri  http://ubuntu:5000
crudini --set  /etc/neutron/neutron.conf  keystone_authtoken auth_url  http://ubuntu:5000
crudini --set  /etc/neutron/neutron.conf  keystone_authtoken memcached_servers  ubuntu:11211
crudini --set  /etc/neutron/neutron.conf  keystone_authtoken auth_type  password
crudini --set  /etc/neutron/neutron.conf  keystone_authtoken project_domain_name  default
crudini --set  /etc/neutron/neutron.conf  keystone_authtoken user_domain_name  default
crudini --set  /etc/neutron/neutron.conf  keystone_authtoken project_name  service
crudini --set  /etc/neutron/neutron.conf  keystone_authtoken username  neutron
crudini --set  /etc/neutron/neutron.conf  keystone_authtoken password  educoder

crudini --set  /etc/neutron/neutron.conf oslo_concurrency lock_path  /var/lib/neutron/tmp


crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 type_drivers  local,flat,vlan,vxlan
crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types  local
crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers  linuxbridge,l2population
crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 extension_drivers  port_security
crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_type_flat  flat_networks  provider
crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_type_vxlan  vni_ranges  1:1000
crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini securitygroup enable_ipset  true

crudini --set  /etc/neutron/plugins/ml2/linuxbridge_agent.ini linux_bridge physical_interface_mappings  provider:enp1s0
crudini --set  /etc/neutron/plugins/ml2/linuxbridge_agent.ini vxlan enable_vxlan  true
crudini --set  /etc/neutron/plugins/ml2/linuxbridge_agent.ini vxlan local_ip  10.0.2.2
crudini --set  /etc/neutron/plugins/ml2/linuxbridge_agent.ini vxlan l2_population  true
crudini --set  /etc/neutron/plugins/ml2/linuxbridge_agent.ini securitygroup enable_security_group  true
crudini --set  /etc/neutron/plugins/ml2/linuxbridge_agent.ini securitygroup firewall_driver  neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

crudini --set  /etc/neutron/l3_agent.ini DEFAULT interface_driver  linuxbridge

crudini --set /etc/neutron/dhcp_agent.ini DEFAULT interface_driver  linuxbridge
crudini --set /etc/neutron/dhcp_agent.ini DEFAULT dhcp_driver  neutron.agent.linux.dhcp.Dnsmasq
crudini --set /etc/neutron/dhcp_agent.ini DEFAULT enable_isolated_metadata  true

crudini --set /etc/neutron/metadata_agent.ini DEFAULT nova_metadata_host  ubuntu
crudini --set /etc/neutron/metadata_agent.ini DEFAULT metadata_proxy_shared_secret  educoder

cat <<EOF >>/etc/sysctl.conf
net.bridge.bridge-nf-call-iptables=1
net.bridge.bridge-nf-call-ip6tables=1
EOF
sysctl -p

crudini --set  /etc/neutron/neutron.conf  nova auth_url  http://ubuntu:5000
crudini --set  /etc/neutron/neutron.conf  nova auth_type  password
crudini --set  /etc/neutron/neutron.conf  nova project_domain_name  default
crudini --set  /etc/neutron/neutron.conf  nova user_domain_name  default
crudini --set  /etc/neutron/neutron.conf  nova region_name  RegionOne
crudini --set  /etc/neutron/neutron.conf  nova project_name  service
crudini --set  /etc/neutron/neutron.conf  nova username  nova
crudini --set  /etc/neutron/neutron.conf  nova password  educoder


crudini --set /etc/nova/nova.conf neutron auth_url  http://ubuntu:5000
crudini --set /etc/nova/nova.conf neutron auth_type  password
crudini --set /etc/nova/nova.conf neutron project_domain_name  default
crudini --set /etc/nova/nova.conf neutron user_domain_name  default
crudini --set /etc/nova/nova.conf neutron region_name  RegionOne
crudini --set /etc/nova/nova.conf neutron project_name  service
crudini --set /etc/nova/nova.conf neutron username  neutron
crudini --set /etc/nova/nova.conf neutron password  educoder
crudini --set /etc/nova/nova.conf neutron service_metadata_proxy  true
crudini --set /etc/nova/nova.conf neutron metadata_proxy_shared_secret  educoder

su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf  --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron

service nova-api restart
service neutron-server restart
service neutron-linuxbridge-agent restart
service neutron-dhcp-agent restart
service neutron-metadata-agent restart
service neutron-l3-agent restart
service nova-compute restart

###########安装dashboard###############
apt install -y openstack-dashboard
cat <<EOF > /etc/openstack-dashboard/local_settings.py
# -*- coding: utf-8 -*-

import os
from django.utils.translation import gettext_lazy as _
from horizon.utils import secret_key
from openstack_dashboard.settings import HORIZON_CONFIG

DEBUG = False
LOCAL_PATH = os.path.dirname(os.path.abspath(__file__))

SECRET_KEY = secret_key.generate_or_read_from_file('/var/lib/openstack-dashboard/secret_key')
CACHES = {'default': {'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache','LOCATION': 'ubuntu:11211',}}
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'


OPENSTACK_HOST = "ubuntu"
OPENSTACK_KEYSTONE_URL = "http://%s:5000/v3" % OPENSTACK_HOST

TIME_ZONE = "Asia/Shanghai"


LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'console': {
            'format': '%(levelname)s %(name)s %(message)s'
        },
        'operation': {
            'format': '%(message)s'
        },
    },
    'handlers': {
        'null': {
            'level': 'DEBUG',
            'class': 'logging.NullHandler',
        },
        'console': {
            'level': 'DEBUG' if DEBUG else 'INFO',
            'class': 'logging.StreamHandler',
            'formatter': 'console',
        },
        'operation': {
            'level': 'INFO',
            'class': 'logging.StreamHandler',
            'formatter': 'operation',
        },
    },
    'loggers': {
        'horizon': {
            'handlers': ['console'],
            'level': 'DEBUG',
            'propagate': False,
        },
        'horizon.operation_log': {
            'handlers': ['operation'],
            'level': 'INFO',
            'propagate': False,
        },
        'openstack_dashboard': {
            'handlers': ['console'],
            'level': 'DEBUG',
            'propagate': False,
        },
        'novaclient': {
            'handlers': ['console'],
            'level': 'DEBUG',
            'propagate': False,
        },
        'cinderclient': {
            'handlers': ['console'],
            'level': 'DEBUG',
            'propagate': False,
        },
        'keystoneauth': {
            'handlers': ['console'],
            'level': 'DEBUG',
            'propagate': False,
        },
        'keystoneclient': {
            'handlers': ['console'],
            'level': 'DEBUG',
            'propagate': False,
        },
        'glanceclient': {
            'handlers': ['console'],
            'level': 'DEBUG',
            'propagate': False,
        },
        'neutronclient': {
            'handlers': ['console'],
            'level': 'DEBUG',
            'propagate': False,
        },
        'swiftclient': {
            'handlers': ['console'],
            'level': 'DEBUG',
            'propagate': False,
        },
        'oslo_policy': {
            'handlers': ['console'],
            'level': 'DEBUG',
            'propagate': False,
        },
        'openstack_auth': {
            'handlers': ['console'],
            'level': 'DEBUG',
            'propagate': False,
        },
        'django': {
            'handlers': ['console'],
            'level': 'DEBUG',
            'propagate': False,
        },
        'django.db.backends': {
            'handlers': ['null'],
            'propagate': False,
        },
        'requests': {
            'handlers': ['null'],
            'propagate': False,
        },
        'urllib3': {
            'handlers': ['null'],
            'propagate': False,
        },
        'chardet.charsetprober': {
            'handlers': ['null'],
            'propagate': False,
        },
        'iso8601': {
            'handlers': ['null'],
            'propagate': False,
        },
        'scss': {
            'handlers': ['null'],
            'propagate': False,
        },
    },
}

SECURITY_GROUP_RULES = {
    'all_tcp': {
        'name': _('All TCP'),
        'ip_protocol': 'tcp',
        'from_port': '1',
        'to_port': '65535',
    },
    'all_udp': {
        'name': _('All UDP'),
        'ip_protocol': 'udp',
        'from_port': '1',
        'to_port': '65535',
    },
    'all_icmp': {
        'name': _('All ICMP'),
        'ip_protocol': 'icmp',
        'from_port': '-1',
        'to_port': '-1',
    },
    'ssh': {
        'name': 'SSH',
        'ip_protocol': 'tcp',
        'from_port': '22',
        'to_port': '22',
    },
    'smtp': {
        'name': 'SMTP',
        'ip_protocol': 'tcp',
        'from_port': '25',
        'to_port': '25',
    },
    'dns': {
        'name': 'DNS',
        'ip_protocol': 'tcp',
        'from_port': '53',
        'to_port': '53',
    },
    'http': {
        'name': 'HTTP',
        'ip_protocol': 'tcp',
        'from_port': '80',
        'to_port': '80',
    },
    'pop3': {
        'name': 'POP3',
        'ip_protocol': 'tcp',
        'from_port': '110',
        'to_port': '110',
    },
    'imap': {
        'name': 'IMAP',
        'ip_protocol': 'tcp',
        'from_port': '143',
        'to_port': '143',
    },
    'ldap': {
        'name': 'LDAP',
        'ip_protocol': 'tcp',
        'from_port': '389',
        'to_port': '389',
    },
    'https': {
        'name': 'HTTPS',
        'ip_protocol': 'tcp',
        'from_port': '443',
        'to_port': '443',
    },
    'smtps': {
        'name': 'SMTPS',
        'ip_protocol': 'tcp',
        'from_port': '465',
        'to_port': '465',
    },
    'imaps': {
        'name': 'IMAPS',
        'ip_protocol': 'tcp',
        'from_port': '993',
        'to_port': '993',
    },
    'pop3s': {
        'name': 'POP3S',
        'ip_protocol': 'tcp',
        'from_port': '995',
        'to_port': '995',
    },
    'ms_sql': {
        'name': 'MS SQL',
        'ip_protocol': 'tcp',
        'from_port': '1433',
        'to_port': '1433',
    },
    'mysql': {
        'name': 'MYSQL',
        'ip_protocol': 'tcp',
        'from_port': '3306',
        'to_port': '3306',
    },
    'rdp': {
        'name': 'RDP',
        'ip_protocol': 'tcp',
        'from_port': '3389',
        'to_port': '3389',
    },
}

DEFAULT_THEME = 'ubuntu'

WEBROOT='/horizon/'

ALLOWED_HOSTS = '*'

COMPRESS_OFFLINE = True
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True
OPENSTACK_API_VERSIONS = {"identity": 3,"image": 2,"volume": 3,}
OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = "Default"
OPENSTACK_KEYSTONE_DEFAULT_ROLE = "user"
EOF

systemctl reload apache2.service
